<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        console.log(Math.min(12,2,51));
        let grade=[12,52,54];
        console.log(Math.min.apply(null,grade));//apple call

        //随机数
        console.log(Math.random());//0--1之间 默认,1取不到
        console.log(Math.ceil(Math.random()*(4+1)));//向上取整，0--4

        //如果我想取2-6的数字呢？
        // console.log(1+Math.ceil(Math.random()*4));

        const table=["oppo手机","iphone手机","华为手机","voio手机"];
        // while(true){
        //     console.log(table[Math.floor(Math.random()*(4))]);
        // }
        console.log(Math.floor(Math.random()*(table.length)));
        console.log(table[Math.floor(Math.random()*(table.length))]);
    </script>
</body>
</html>